package com.aiguigu.gulimall.cart.config;

import com.aiguigu.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: charls
 * @Description:TODO
 * @Date: 2023/05/24/ 17:50
 * @Version: 1.0
 */

@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截购物车下来的所有请求
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
